<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>用户信息</title>
    <link href="css/font-awesome.min.css" rel="stylesheet" />
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    <link href="css/templatemo-style.css" rel="stylesheet" />
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js"></script>
    <script src="http://cdn.bootcss.com/blueimp-md5/1.1.0/js/md5.js"></script>
    <script src="js/vue.min.js"></script>
    <script src="js/api.js"></script>
  </head>

  <body>
    <div class="templatemo-flex-row">
      <div class="templatemo-sidebar">
        <div class="mobile-menu-icon">
          <i class="fa fa-bars"></i>
        </div>
        <nav class="templatemo-left-nav">
          <ul>
            <li>
              <a href="考试中心.html"
                ><i class="fa fa-map-marker fa-fw"></i>考试中心</a
              >
            </li>
            <li>
              <a href="成绩中心.html"
                ><i class="fa fa-bar-chart fa-fw"></i>成绩中心</a
              >
            </li>
            <li>
              <a class="active"
                ><i class="fa fa-star" aria-hidden="true"></i>用户信息</a
              >
            </li>
            <li>
              <a href="个人信息.html"
                ><i class="fa fa-user-o" aria-hidden="true"></i>个人信息</a
              >
            </li>
            <li>
              <a href="index.html"><i class="fa fa-eject fa-fw"></i>退出</a>
            </li>
          </ul>
        </nav>
      </div>
      <div class="templatemo-content col-1 light-gray-bg">
        <div class="templatemo-content-container">
          <div
            class="templatemo-flex-row flex-content-row templatemo-overflow-hidden"
          >
            <div class="col-1 templatemo-overflow-hidden">
              <div
                class="templatemo-content-widget white-bg templatemo-overflow-hidden"
              >
                <div class="templatemo-flex-row flex-content-row">
                  <div id="app" class="container">
                    <div class="col-xs-3">
                      <select
                        id="selectInfor"
                        class="form-control"
                        @change="changeOption"
                      >
                        <option value="1">学生信息</option>
                        <option value="2">教师信息</option>
                      </select>
                    </div>
                    <button
                      type="button"
                      class="btn btn-primary"
                      data-toggle="modal"
                      v-if="stuFlag"
                      data-target=".studentInfor-modal-add"
                    >
                      添加学生信息
                    </button>
                    <button
                      type="button"
                      class="btn btn-primary"
                      data-toggle="modal"
                      v-if="teaFlag"
                      data-target=".teacherInfor-add"
                    >
                      添加教师信息
                    </button>
                    <table class="table table-hover" v-if="stuFlag">
                      <tr class="tb_head">
                        <th>学号</th>
                        <th>学生姓名</th>
                        <th>专业</th>
                        <th>邮箱</th>
                        <th>手机号</th>
                        <th>操作</th>
                      </tr>

                      <tr v-for="item in studentInfoList">
                        <td>{{ item.student_no }}</td>
                        <td>{{ item.student_name }}</td>
                        <td>{{ item.profession_name }}</td>
                        <td>{{ item.student_email }}</td>
                        <td>{{ item.student_phone }}</td>
                        <td>
                          <div
                            class="btn-group btn-group-sm"
                            role="group"
                            aria-label="..."
                          >
                            <button
                              type="button"
                              class="btn btn-warning"
                              data-toggle="modal"
                              data-target=".studentInfor-modal"
                              :value="item.student_no"
                              @click="showMoStudentInfo"
                            >
                              修改信息
                            </button>
                            <button
                              type="button"
                              :value="item.student_no"
                              class="btn btn-danger"
                              @click="deleteStudent"
                            >
                              删除
                            </button>
                          </div>
                        </td>
                      </tr>

                      <div
                        class="modal fade studentInfor-modal"
                        tabindex="-1"
                        role="dialog"
                        aria-labelledby="myLargeModalLabel"
                      >
                        <div class="modal-dialog modal-lg" role="document">
                          <div class="modal-content">
                            <form class="form-horizontal">
                              <div class="form-group col-xs-6">
                                <label class="col-sm-2 control-label"
                                  >学号：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="student_no"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    maxlength="11"
                                    oninput="this.value=this.value.replace(/\s+/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >姓名：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="student_name"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    oninput="this.value=this.value.replace(/\s+/g,'');value=value.replace(/[^\u4E00-\u9FA5]/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >手机：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="student_phone"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    maxlength="11"
                                    oninput="this.value=this.value.replace(/\s+/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >专业：</label
                                >
                                <div class="col-xs-5">
                                  <select
                                    id="selectProfession"
                                    class="form-control"
                                  >
                                    <option value="-1">--请选择--</option>
                                    <option
                                      v-for="item in procouList"
                                      :value="item.profession_no"
                                    >
                                      {{ item.profession_name }}</option
                                    >
                                  </select>
                                </div>
                              </div>

                              <div class="modal-footer">
                                <button
                                  type="button"
                                  class="btn btn-default"
                                  data-dismiss="modal"
                                >
                                  取消
                                </button>
                                <button
                                  type="button"
                                  class="btn btn-primary"
                                  data-dismiss="modal"
                                  @click="updateStudentInfor"
                                  :value="readyMoStuInfo.student_no"
                                >
                                  确定
                                </button>
                              </div>
                            </form>
                          </div>
                        </div>
                      </div>
                    </table>

                    <table class="table table-hover" v-if="teaFlag">
                      <tr class="tb_head">
                        <th>工号</th>
                        <th>教师姓名</th>
                        <th>邮箱</th>
                        <th>手机号</th>
                        <th>操作</th>
                      </tr>

                      <tr v-for="item in teacherInforList">
                        <td>{{ item.teacher_no }}</td>
                        <td>{{ item.teacher_name }}</td>
                        <td>{{ item.teacher_email }}</td>
                        <td>{{ item.teacher_phone }}</td>
                        <td>
                          <button
                            type="button"
                            :value="item.teacher_no"
                            class="btn btn-danger"
                            @click="deleteTeacherInfor"
                          >
                            删除
                          </button>
                          <button
                            type="button"
                            class="btn btn-primary"
                            data-toggle="modal"
                            :value="item.teacher_no"
                            data-target=".teacherInfor-modal"
                            @click="showUpdataTeacher"
                          >
                            修改信息
                          </button>
                          <button
                            type="button"
                            class="btn btn-warning"
                            data-toggle="modal"
                            :value="item.teacher_no"
                            data-target=" .teacherPassWord-modal"
                            @click="getReadyMoTeaInfo"
                          >
                            修改密码
                          </button>
                        </td>
                      </tr>

                      <!-- 修改教师个人信息 -->
                      <div
                        class="modal fade teacherInfor-modal"
                        tabindex="-1"
                        role="dialog"
                        aria-labelledby="myLargeModalLabel"
                      >
                        <div class="modal-dialog modal-lg" role="document">
                          <div class="modal-content">
                            <form class="form-horizontal">
                              <div class="form-group col-xs-6">
                                <label class="col-sm-2 control-label"
                                  >工号：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="teacher_no_updata"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    maxlength="11"
                                    oninput="this.value=this.value.replace(/\s+/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >姓名：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="teacher_name_updata"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    oninput="this.value=this.value.replace(/\s+/g,'');value=value.replace(/[^\u4E00-\u9FA5]/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >手机：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="teacher_phone_updata"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    maxlength="11"
                                    oninput="this.value=this.value.replace(/\s+/g,'')"
                                  />
                                </div>
                              </div>

                              <div class="modal-footer">
                                <button
                                  type="button"
                                  class="btn btn-default"
                                  data-dismiss="modal"
                                >
                                  取消
                                </button>
                                <button
                                  type="button"
                                  class="btn btn-primary"
                                  data-dismiss="modal"
                                  :value="readyMoTeaInfo.teacher_no"
                                  @click="updataTeaerInfor"
                                >
                                  确定
                                </button>
                              </div>
                            </form>
                          </div>
                        </div>
                      </div>
                      <!-- 修改教师个人信息 -->

                      <!-- 修改教师密码 -->
                      <div
                        class="modal fade teacherPassWord-modal"
                        tabindex="-1"
                        role="dialog"
                        aria-labelledby="myLargeModalLabel"
                      >
                        <div class="modal-dialog modal-lg" role="document">
                          <div class="modal-content">
                            <form class="form-horizontal">
                              <div class="form-group col-xs-6">
                                <label class="col-sm-3 control-label"
                                  >新密码：</label
                                >
                                <div class="col-sm-8">
                                  <input
                                    id="teacher_pw_updata"
                                    type="password"
                                    class="form-control"
                                    autocomplete="off"
                                    oninput="this.value=this.value.replace(/\s+/g,'')"
                                  />
                                </div>
                              </div>
                              <div class="modal-footer">
                                <button
                                  type="button"
                                  class="btn btn-default"
                                  data-dismiss="modal"
                                >
                                  取消
                                </button>
                                <button
                                  type="button"
                                  class="btn btn-primary"
                                  data-dismiss="modal"
                                  @click="updateTeacherPassWord"
                                  :value="readyMoTeaInfo.teacher_no"
                                >
                                  确定
                                </button>
                              </div>
                            </form>
                          </div>
                        </div>
                      </div>

                      <!-- 添加学生信息 -->
                      <div
                        class="modal fade studentInfor-modal-add"
                        tabindex="-1"
                        role="dialog"
                        aria-labelledby="myLargeModalLabel"
                      >
                        <div class="modal-dialog modal-lg" role="document">
                          <div class="modal-content">
                            <form class="form-horizontal">
                              <div class="form-group col-xs-6">
                                <label class="col-sm-2 control-label"
                                  >学号：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="student_no_add"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    maxlength="11"
                                    oninput="this.value=this.value.replace(/\s+/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >姓名：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="student_name_add"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    oninput="this.value=this.value.replace(/\s+/g,'');value=value.replace(/[^\u4E00-\u9FA5]/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >密码：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="student_pw_add"
                                    type="password"
                                    class="form-control"
                                    autocomplete="off"
                                    oninput="this.value=this.value.replace(/\s+/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >手机：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="student_phone_add"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    maxlength="11"
                                    oninput="this.value=this.value.replace(/\s+/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >专业：</label
                                >
                                <div class="col-xs-5">
                                  <select
                                    id="selectProfession_add"
                                    class="form-control"
                                  >
                                    <option value="-1">--请选择--</option>
                                    <option
                                      v-for="item in procouList"
                                      :value="item.profession_no"
                                    >
                                      {{ item.profession_name }}</option
                                    >
                                  </select>
                                </div>
                              </div>

                              <div class="modal-footer">
                                <button
                                  type="button"
                                  class="btn btn-default"
                                  data-dismiss="modal"
                                >
                                  取消
                                </button>
                                <button
                                  type="button"
                                  class="btn btn-primary"
                                  data-dismiss="modal"
                                  @click="addStudentInfor"
                                >
                                  确定
                                </button>
                              </div>
                            </form>
                          </div>
                        </div>
                      </div>
                      <!-- 添加学生信息 -->

                      <!-- 添加教师信息 -->
                      <div
                        class="modal fade teacherInfor-add"
                        tabindex="-1"
                        role="dialog"
                        aria-labelledby="myLargeModalLabel"
                      >
                        <div class="modal-dialog modal-lg" role="document">
                          <div class="modal-content">
                            <form class="form-horizontal">
                              <div class="form-group col-xs-6">
                                <label class="col-sm-2 control-label"
                                  >工号：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="teacher_no_add"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    maxlength="11"
                                    oninput="this.value=this.value.replace(/\s+/g,'');this.value=value.replace(/[^\d]/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >姓名：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="teacher_name_add"
                                    type="text"
                                    class="form-control"
                                    autocomplete="off"
                                    oninput="this.value=this.value.replace(/\s+/g,'');value=value.replace(/[^\u4E00-\u9FA5]/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >密码：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="teacher_pw_add"
                                    type="password"
                                    class="form-control"
                                    autocomplete="off"
                                    oninput="this.value=this.value.replace(/\s+/g,'')"
                                  />
                                </div>

                                <label class="col-sm-2 control-label"
                                  >手机：</label
                                >
                                <div class="col-sm-10">
                                  <input
                                    id="teacher_phone_add"
                                    type="text"
                                    class="form-control"
                                    maxlength="11"
                                    autocomplete="off"
                                    oninput="this.value=this.value.replace(/\s+/g,'');this.value=value.replace(/[^\d]/g,'')"
                                  />
                                </div>
                              </div>

                              <div class="modal-footer">
                                <button
                                  type="button"
                                  class="btn btn-default"
                                  data-dismiss="modal"
                                >
                                  取消
                                </button>
                                <button
                                  type="button"
                                  class="btn btn-primary"
                                  data-dismiss="modal"
                                  :value="readyMoTeaInfo.teacher_no"
                                  @click="addTeacherInfor"
                                >
                                  确定
                                </button>
                              </div>
                            </form>
                          </div>
                        </div>
                      </div>
                      <!-- 添加教师信息 -->
                    </table>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <script src="js/用户信息.js"></script>
  </body>
</html>
